//
//  RootViewController.m
//  Quick_News
//
//  Created by 曾凯峻 on 15/1/29.
//  Copyright (c) 2015年 zkj. All rights reserved.
//

#import "RootViewController.h"
#import "HeaderViewController.h"
#import "WeatherViewController.h"
#import "SCNavTabBarController.h"
#import "MoreViewController.h"
#import "AmuesViewController.h"
#import "FashionViewController.h"
#import "FinanceViewController.h"
#import "GameViewController.h"
#import "HistoryViewController.h"
#import "MilitaryViewController.h"
#import "MovieViewController.h"
#import "SocietyViewController.h"
#import "SportsViewController.h"
#import "TechnologyViewController.h"
@interface RootViewController ()

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self creatView];
}
- (void)creatView
{
    //导航栏颜色
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:255 / 255.0 green:0 / 255.0 blue:51 / 255.0 alpha:1];
    
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.navigationController.navigationBarHidden = NO;//不隐藏
    
    self.title = @"NEWS";
    
    //设置右上角导航栏
    self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"gengduo.png"] style:UIBarButtonItemStyleDone target:self action:@selector(rightBarAction:)] autorelease];
    //设置左上角导航栏
    self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"tianqi.png"] style:UIBarButtonItemStyleDone target:self action:@selector(leftBarAction:)] autorelease];
    
    HeaderViewController *newsVC = [[HeaderViewController alloc]init];
    newsVC.title = @"头条";
 //   newsVC.view.backgroundColor = [UIColor cyanColor];
    
    AmuesViewController *amuseVC = [[AmuesViewController alloc]init];
    amuseVC.title = @"娱乐";
    amuseVC.view.backgroundColor = [UIColor yellowColor];
    
    SportsViewController *sportsVC = [[SportsViewController alloc]init];
    sportsVC.title = @"体育";
    sportsVC.view.backgroundColor = [UIColor cyanColor];
    
    
    SocietyViewController *societyVC = [[SocietyViewController alloc]init];
    societyVC.title = @"社会";
    societyVC.view.backgroundColor = [UIColor orangeColor];
    
    FinanceViewController *financeNV = [[FinanceViewController alloc]init];
    financeNV.title = @"财经";
    financeNV.view.backgroundColor = [UIColor blackColor];
    
    TechnologyViewController *technologyVC = [[TechnologyViewController alloc]init];
    technologyVC.title = @"科技";
    technologyVC.view.backgroundColor = [UIColor orangeColor];
    
    MilitaryViewController *militaryVC = [[MilitaryViewController alloc]init];
    militaryVC.title = @"军事";
    militaryVC.view.backgroundColor = [UIColor purpleColor];
    
    
    HistoryViewController *historyVC = [[HistoryViewController alloc]init];
    historyVC.title = @"历史";
    historyVC.view.backgroundColor = [UIColor yellowColor];
    
    FashionViewController *fashionVC = [[FashionViewController alloc]init];
    fashionVC.title = @"时尚";
    fashionVC.view.backgroundColor = [UIColor grayColor];
    
    GameViewController *gameVC = [[GameViewController alloc]init];
    gameVC.title = @"游戏";
    gameVC.view.backgroundColor = [UIColor yellowColor];
    
    MovieViewController *movieVC = [[MovieViewController alloc]init];
    movieVC.title = @"电影";
    movieVC.view.backgroundColor = [UIColor blueColor];
    
    UIViewController *shortVC = [[UIViewController alloc]init];
    shortVC.title = @"段子";
    shortVC.view.backgroundColor = [UIColor orangeColor];
    
    
    //创建主TabBarController
    SCNavTabBarController *navTabBarController = [[SCNavTabBarController alloc]init];
    navTabBarController.subViewControllers = @[newsVC,amuseVC,sportsVC, societyVC,financeNV,technologyVC,militaryVC,historyVC,fashionVC,gameVC,movieVC,shortVC];
    
    navTabBarController.showArrowButton = YES;
    [navTabBarController addParentController:self];
    //内存
    [navTabBarController release];
    [newsVC release];
    [amuseVC release];
    [sportsVC release];
    [societyVC release];
    [financeNV release];
    [technologyVC release];
    [militaryVC release];
    [historyVC release];
    [fashionVC release];
    [gameVC release];
    [movieVC release];
    [shortVC release];
    
}
//右上角跳转方法
- (void)rightBarAction:(UIButton *)bar
{
    MoreViewController *moreVC = [[MoreViewController alloc] init];
    [self.navigationController pushViewController:moreVC animated:YES];
    [moreVC release];
}
//左上角跳转方法
- (void)leftBarAction:(UIButton *)bar
{
    WeatherViewController *weatherVC = [[WeatherViewController alloc]init];
    [self.navigationController pushViewController:weatherVC animated:YES];
    [weatherVC release];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
